package com.test;

import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.paas.base.modules.utils.lang.StringUtil;
import com.qhgrain.gway.util.HttpUtil;

public class MenuService {

	public static String getBaseURI() {
//		return "http://127.0.0.1:8081/menurolepermission/1.0.0/menu";
		return "http://192.168.10.37:8581/menurolepermission/1.0.0/menu";
	} 
	
	public static void queryParentMenus() throws IOException{
		String id = "6";
		
		String vo = HttpUtil.get(getBaseURI()+"/query/parent/menus/"+id,new HashMap<String,String>() );
		System.out.println(JSONObject.toJSONString(vo));
	}
	
	public static void queryTopMenus() throws IOException{
		Map<String,Object> paramMap = new HashMap<String,Object>();
		paramMap.put("appId", "2");
		String vo = HttpUtil.postFormParams(getBaseURI(), "/query/top/menus", paramMap);
		System.out.println(vo);
	}
	public static void queryChildMenus() throws IOException{
		Map<String,Object> paramMap = new HashMap<String,Object>();
		paramMap.put("menuId", "1");
		paramMap.put("isQueryAll", "true");
		String vo = HttpUtil.postFormParams(getBaseURI(), "/query/child/menus", paramMap);
		System.out.println(vo);
	}
	public static void getAll() throws Exception{
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("appId", "gway0000769dg3034hpkmhhaaqum2zyqpcnubrty");
		
		map.put("userId", "11");
		map.put("status", null);
		
		String restVo = HttpUtil.postFormParams(getBaseURI(), "/query/all"	, map);
		System.out.println(restVo);
	}
	public static void main(String[] args) throws Exception {
//		find();
//		queryParentMenus();
//		queryTopMenus();
//		queryChildMenus();
		getAll();
	}
}
